/*     */ package com.iris.egrant.web.struts2.tags;
/*     */ 
/*     */ import com.iris.egrant.app.utils.IrisStringUtils;
/*     */ import freemarker.template.Configuration;
/*     */ import freemarker.template.Template;
/*     */ import java.io.Writer;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.jsp.JspException;
/*     */ import javax.servlet.jsp.tagext.BodyTagSupport;
/*     */ import net.sf.json.JSONSerializer;
/*     */ import org.springframework.context.i18n.LocaleContextHolder;
/*     */ import org.springframework.web.context.WebApplicationContext;
/*     */ import org.springframework.web.context.support.WebApplicationContextUtils;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class SelectBySqlTag
/*     */   extends BodyTagSupport
/*     */ {
/*     */   private static final long serialVersionUID = 1077194066541229822L;
/*  31 */   private String id = "";
/*     */   
/*  33 */   private String locale = "";
/*     */   
/*  35 */   private List<Map> data = null;
/*     */ 
/*     */   
/*  38 */   private String cacheable = "true";
/*     */   
/*  40 */   private String sql = "";
/*     */ 
/*     */   
/*  43 */   private String className = "";
/*     */   
/*  45 */   private String value = "";
/*     */ 
/*     */   
/*  48 */   private String onChange = "";
/*     */   
/*  50 */   private String extendEvent = "";
/*     */   
/*     */   public String getCacheable() {
/*  53 */     return this.cacheable;
/*     */   }
/*     */   
/*     */   public void setCacheable(String cacheable) {
/*  57 */     this.cacheable = cacheable;
/*     */   }
/*     */   
/*     */   public String getLocale() {
/*  61 */     if (IrisStringUtils.isNullOrBlank(this.locale)) {
/*  62 */       return LocaleContextHolder.getLocale().toString();
/*     */     }
/*  64 */     return this.locale;
/*     */   }
/*     */   
/*     */   public void setLocale(String locale) {
/*  68 */     this.locale = locale;
/*     */   }
/*     */ 
/*     */   
/*     */   public List<Map> getData() {
/*  73 */     return this.data;
/*     */   }
/*     */ 
/*     */   
/*     */   public void setData(List<Map> data) {
/*  78 */     this.data = data;
/*     */   }
/*     */ 
/*     */   
/*     */   public int doStartTag() throws JspException {
/*  83 */     WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(this.pageContext.getServletContext());
/*     */ 
/*     */     
/*  86 */     Configuration cptFreemarkereConfiguration = (Configuration)context.getBean("cptFreemarkereConfiguration");
/*     */     
/*     */     try {
/*  89 */       String res = (String)this.pageContext.getAttribute("res");
/*  90 */       String ctx = (String)this.pageContext.getAttribute("ctx");
/*     */       
/*  92 */       Map<String, Object> params = new HashMap<String, Object>();
/*  93 */       params.put("sql", this.sql);
/*  94 */       params.put("cacheable", this.cacheable);
/*  95 */       params.put("locale", getLocale());
/*     */       
/*  97 */       Map<String, Object> rootMap = new HashMap<String, Object>();
/*  98 */       rootMap.put("res", res);
/*  99 */       rootMap.put("id", this.id);
/* 100 */       if (this.data != null) {
/* 101 */         rootMap.put("data", this.data);
/*     */       }
/*     */       
/* 104 */       rootMap.put("ctx", ctx);
/* 105 */       rootMap.put("params", JSONSerializer.toJSON(params).toString());
/* 106 */       rootMap.put("className", this.className);
/* 107 */       rootMap.put("value", this.value);
/* 108 */       rootMap.put("onChange", this.onChange);
/* 109 */       rootMap.put("extendEvent", this.extendEvent);
/* 110 */       Template template = cptFreemarkereConfiguration.getTemplate("selectBySql.ftl", "utf-8");
/*     */       
/* 112 */       template.process(rootMap, (Writer)this.pageContext.getOut());
/*     */     }
/* 114 */     catch (Exception e) {
/* 115 */       throw new JspException(e);
/*     */     } 
/*     */     
/* 118 */     return 0;
/*     */   }
/*     */ 
/*     */   
/*     */   public String getId() {
/* 123 */     return this.id;
/*     */   }
/*     */ 
/*     */   
/*     */   public void setId(String id) {
/* 128 */     this.id = id;
/*     */   }
/*     */   
/*     */   public String getClassName() {
/* 132 */     return this.className;
/*     */   }
/*     */   
/*     */   public void setClassName(String className) {
/* 136 */     this.className = className;
/*     */   }
/*     */   
/*     */   public String getValue() {
/* 140 */     return this.value;
/*     */   }
/*     */   
/*     */   public void setValue(String value) {
/* 144 */     this.value = value;
/*     */   }
/*     */   
/*     */   public String getOnChange() {
/* 148 */     return this.onChange;
/*     */   }
/*     */   
/*     */   public void setOnChange(String onChange) {
/* 152 */     this.onChange = onChange;
/*     */   }
/*     */   
/*     */   public String getExtendEvent() {
/* 156 */     return this.extendEvent;
/*     */   }
/*     */   
/*     */   public void setExtendEvent(String extendEvent) {
/* 160 */     this.extendEvent = extendEvent;
/*     */   }
/*     */   
/*     */   public String getSql() {
/* 164 */     return this.sql;
/*     */   }
/*     */   
/*     */   public void setSql(String sql) {
/* 168 */     this.sql = sql;
/*     */   }
/*     */ }


/* Location:              D:\文件kjt\WEB-INF\lib\egrant-core-2.2.20240205.1659.jar!\com\iris\egrant\web\struts2\tags\SelectBySqlTag.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */